package com.kristin.net;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class WebClient {

    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("127.0.0.1", 8080));

        ByteBuffer writeBuffer = ByteBuffer.allocate(128);
        writeBuffer.put("hello world".getBytes());

        writeBuffer.flip();
        socketChannel.write(writeBuffer);
        socketChannel.close();

    }

}
